package mapper;

import DO.TeacherDO;
import DTO.AddTeacherDTO;
import DTO.EditStudentPasswordDTO;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface TeacherMapper {

    @Select("select * from teacher")
    List<TeacherDO> getTeachers();

    @Select("select * from teacher where level = #{eleve}")
    Integer getTeacherByeleve(Integer eleve);

    @Update("update teacher set password = #{password} where id = #{id}")
    void resetTeacherPassword(Integer id,String password);

    @Delete("delete from teacher where id = #{id}")
    void deleteTeacher(Integer id);

    @Insert("INSERT into teacher (username, user_number, password) VALUES (#{username},#{userNumber},#{password})")
    void save(String username, String userNumber, String password);

    @Select("select password from teacher where id = #{id}")
    String getPasswordById(Integer id);

    @Update("update teacher set password = #{newPassword} where id = #{id}")
    void updatePassword(String newPassword,Integer id);
}
